import logo from './logo.svg';
import './App.css';
import { useEffect, useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { dec, ins } from './store/modules/counterStroe';
const Sun = () => {
  const counterStore = useSelector(state => state.counterStore);
  const { count } = counterStore;
  const dispatch = useDispatch();
  return 
  <span>
    {count}
    <button onClick={() => { dispatch(ins()) }}>+</button>
    <button onClick={() => { dispatch(dec()) }}>-</button>
  </span>
}
function App() {

  return (
    <div className="App">
      <header className="App-header">
        <Sun></Sun>
        <Sun></Sun>
      </header>

    </div>
  );
}

export default App;
